home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / RELNOTES / JTI.TXT < prev    next >
Encoding:
Text File  |  1998-09-16  |  3.8 KB  |  94 lines

  1. ===========================================================================
  2.  
  3.                         VisualAge for Java
  4.                            Version 2.0
  5.  
  6.                       Java Tool Integration
  7.  
  8.                          RELEASE NOTES
  9.  
  10. ===========================================================================
  11.  
  12. Table of Contents
  13.  
  14. 1.0 Integrating Tools written in Java
  15.    1.1 Concurrent use of classes by tools and loaded user code
  16.    1.2 Testing tool code inside VisualAge for Java
  17.  
  18.  
  19.  
  20.  
  21. 1.0 Integrating Tools written in Java
  22.  
  23. 1.1 Concurrent use of classes by tools and loaded user code
  24.  
  25. At present, VisualAge for Java does not support concurrent loading
  26. of classes with the same name from different sources (ie. some from
  27. the workspace and some from the file system). This is likely not an
  28. issue in typical application development scenarios, however, it can
  29. cause problems for tool developers.  Tools frequently generate code
  30. against a set of runtime libraries that need to be loaded into the
  31. workspace (otherwise the internal compiler will tag the generated
  32. code in error). The same set of runtime classes may also be needed
  33. for execution of the tool itself. Since the classpath setting for
  34. tool execution is limited to the tool installation directory (plus
  35. system libraries), the runtime classes also have to be present in the
  36. tool installation directory.  Concurrent execution of the tool, and
  37. its generated code will result in an attempt to load the same class
  38. from the workspace and the file system.  Typically, this will
  39. manifest itself as an exception indicating inability to find a class.
  40. Terminate the offending programs and rerun them one at a time.
  41.  
  42. Tool developers should avoid this situation by sharing the runtime
  43. code loaded into the workspace. Tool writers can use the "IBM IDE
  44. Utility class libraries" API to check if a copy of the required
  45. runtime is loaded, and if it is not, instruct the user to load the
  46. runtime (likely packaged as a Java feature).  Alternatively, the tool
  47. code can cause a copy of the required runtime to be loaded from the
  48. repository as part of tool execution. The following code sample
  49. illustrates the API calls required (no error checking):
  50.  
  51. // assume import com.ibm.ivj.util.base.*;
  52.  
  53.    Workspace ws = ToolEnv.connectToWorkspace();
  54.  
  55. // Check for existence of prerequisite runtime
  56.  
  57.    String prereq = "My Required Runtime Project";
  58.    Project proj = ws.loadedProjectNamed(prereq);
  59.  
  60. // Load from repository if needed.
  61. // Alternatively, terminate execution and instruct user to load runtime
  62.  
  63.    if (proj == null) {
  64.       Repository rep = ws.getRepository();
  65.       ProjectEdition[] projList = rep.getProjectEditions(prereq);
  66.       projList[0].loadIntoWorkspace(); // assume exactly 1 in repository
  67.       proj = ws.loadedProjectNamed(prereq);
  68.    }
  69.  
  70. // Add required project to current classpath
  71.  
  72.    Object[] current = ws.getClassPathEntries();
  73.    Object[] newPath = new Object[current.length+1];
  74.    newPath[0] = proj; // as first entry on classpath
  75.    for (int i=0; i<current.length; i++) newPath[i+1] = current[i];
  76.    ws.setClassPath(newPath);
  77.  
  78.  
  79. 1.2 Testing tool code inside VisualAge for Java
  80.  
  81. While under development, tools are typically tested in the workspace
  82. by running the main() method of the tool. When doing so, ensure that
  83. the classpath is properly set for the tool execution. Open the
  84. "Properties" dialog for the main tool class. The tool classpath must
  85. include the following two projects:
  86.  
  87.    IBM IDE Utility class libraries
  88.    IBM IDE Utility local implementation
  89.  
  90. The first project is shipped in the repository, as well as the file
  91. system (ide\project_resources\IBM IDE Utility class libraries).  The
  92. second is only shipped in the file system (ide\project_resources\IBM
  93. IDE Utility local implementation).
  94.